

#ifndef _READWRITE_BT_H_
#define _READWRITE_BT_H_

#include <BImage>
#include <BReadWrite>

using namespace BWE;

class ReadWrite_bmp : public BReadWrite
{
public:
	ReadWrite_bmp();
	~ReadWrite_bmp();

	virtual void setOptions(const BString& options) override;
	virtual const BString& options() const override;

	virtual BObject* load(const BString& fileName) override;
	virtual bool load(const BString& fileName, BObject* object) override;
	virtual bool save(const BString& fileName, const BObject* object) const override;

	virtual BObject* read(const BBuffer& buffer) override;
	virtual bool read(const BBuffer& buffer, BObject* object) override;
	virtual bool write(BBuffer& buffer, const BObject* object) const override;

	virtual const BString& author() const;
	virtual const BString& version() const;
	virtual const BString& description() const;
	virtual const BString& message() const;

protected:
	/*
	BM	Windows 3.1x, 95, NT
	BA	OS/2 Bitmap Array
	CI	OS/2 Color Icon
	CP	OS/2 Color Pointer
	IC	OS/2 Icon
	PT	OS/2 Pointer
*/
#pragma pack(1)
	struct Head
	{
		Head()
		{
			dentifier[0] = 0;
			dentifier[1] = 0;
			fileSize = 0;
			reserved = 0;
			dataOffset = 0;
			headerSize = 0;

			width = 0;
			height = 0;
			planes = 0;
			pixelBits = 0;

			compression = 0;
			dataSize = 0;
			HResolution = 0;
			VResolution = 0;

			colorsInPalette = 0;
			importantColors = 0;
		}

		char			dentifier[2];
		unsigned int	fileSize;
		unsigned int	reserved;
		unsigned int	dataOffset;
		unsigned int	headerSize;

		unsigned int	width;
		unsigned int	height;
		unsigned short	planes;
		unsigned short	pixelBits;

		unsigned int	compression;
		unsigned int	dataSize;
		unsigned int	HResolution;
		unsigned int	VResolution;

		unsigned int	colorsInPalette;
		unsigned int	importantColors;
	};
#pragma pack()

private:
	BString			_author;
	BString			_version;
	BString			_description;
	BString			_message;
	BString			_options;
	BString			_log;
};

#endif